import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ActAdjustConfigVO, ActAdjustConfigForm, ActAdjustConfigQuery } from '@/api/budget/actAdjustConfig/types';

/**
 * 查询中期调整时间范围配置列表
 * @param query
 * @returns {*}
 */

export const listActAdjustConfig = (query?: ActAdjustConfigQuery): AxiosPromise<ActAdjustConfigVO[]> => {
  return request({
    url: '/system/actAdjustConfig/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询中期调整时间范围配置详细
 * @param id
 */
export const getActAdjustConfig = (id: string | number): AxiosPromise<ActAdjustConfigVO> => {
  return request({
    url: '/system/actAdjustConfig/' + id,
    method: 'get'
  });
};

/**
 * 新增中期调整时间范围配置
 * @param data
 */
export const addActAdjustConfig = (data: ActAdjustConfigForm) => {
  return request({
    url: '/system/actAdjustConfig',
    method: 'post',
    data: data
  });
};

/**
 * 修改中期调整时间范围配置
 * @param data
 */
export const updateActAdjustConfig = (data: ActAdjustConfigForm) => {
  return request({
    url: '/system/actAdjustConfig',
    method: 'put',
    data: data
  });
};

/**
 * 校验是否在中期调整

 */
export const checkConfig = (type: string) => {
  return request({
    url: '/system/actAdjustConfig/checkConfig/' + type,
    method: 'get'
  });
};
